package com.retrifot2.myretrifot2;

import com.retrifot2.myretrifot2.requestServiice.RequestserviceGetData;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class ServerUnitls {
    private static ServerUnitls unitl;
    private Retrofit retrofit;
    private final RequestserviceGetData requestservice;

    private ServerUnitls() {
        retrofit = new Retrofit.Builder()
                .baseUrl(Constant.URL_BASE_HONGYANQUAN)
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .build();
        requestservice = retrofit.create(RequestserviceGetData.class);

    }
    public static ServerUnitls getInstance(){

        if(unitl==null){
            unitl=new ServerUnitls();
        }
        return unitl;
    }
    public RequestserviceGetData getRequestservice(){
        return requestservice;
    }

}
